<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateTableArticleStatisticsLogs extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('article_statistics_logs', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('articleId')->default(0)->comment('文章 ID');
            $table->unsignedInteger('type')->default(0)
                  ->comment('数据来源0默认 1: 点赞 2: 取消点赞, 3:收藏数 4:取消收藏 5:转发数 6: 阅读 7:展示');
            $table->json('content')->default(null)->comment('日志内容 默认空');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->tinyInteger('isDeleted')->default(0)->comment('');

            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '文章_操作日志';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('article_statistics_logs');
    }
}
